﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.Runtime.Serialization;
namespace GSLMS.Entity
{
	/// <summary>
	/// 2.2.14    凭证模版设置信息表
	/// </summary>
	[DataContract(IsReference = true)]
	public partial class TB_FIN_VOUCHERMAS: IObjectWithChangeTracker, INotifyPropertyChanged
	{
		public TB_FIN_VOUCHERMAS()
		{}
		#region Model
		private long _id;
		private int _systemid;
		private int _paytype;
		private int _busstype;
		private int _payment;
		private string _feeobj;
		private string _subcode;
		private string _subname;
		private string _custname;
		private long _custid;
		private string _empname;
		private long _empid;
		private int _direct;
		private string _createby;
		private Nullable<DateTime> _createdate;
		/// <summary>
		/// 记录ID
		/// </summary>
		[DataMember]
		public long ID
		{
			get{return _id;}
			set{
				if ( _id!= value)
				{
					if (ChangeTracker.ChangeTrackingEnabled && ChangeTracker.State != ObjectState.Added)
					{
						throw new InvalidOperationException("属性“ID”是对象键的一部分，不可更改。仅当未跟踪对象或对象处于“已添加”状态时，才能对键属性进行更改。");
					}
					 _id = value;
					OnPropertyChanged("ID");
				}
			}
		}
		/// <summary>
		/// 来源信贷、典当、租赁
		/// </summary>
		[DataMember]
		public int SYSTEMID
		{
			get{return _systemid;}
			set{
				if ( _systemid!= value)
				{
					 _systemid = value;
					OnPropertyChanged("SYSTEMID");
				}
			}
		}
		/// <summary>
		/// 收付类型1放款、2收款、3借入、4借出、5预收款
		/// </summary>
		[DataMember]
		public int PAYTYPE
		{
			get{return _paytype;}
			set{
				if ( _paytype!= value)
				{
					 _paytype = value;
					OnPropertyChanged("PAYTYPE");
				}
			}
		}
		/// <summary>
		/// 业务类型2期间借款、3赎楼、4租赁
		/// </summary>
		[DataMember]
		public int BUSSTYPE
		{
			get{return _busstype;}
			set{
				if ( _busstype!= value)
				{
					 _busstype = value;
					OnPropertyChanged("BUSSTYPE");
				}
			}
		}
		/// <summary>
		/// 还款方式
		/// </summary>
		[DataMember]
		public int PAYMENT
		{
			get{return _payment;}
			set{
				if ( _payment!= value)
				{
					 _payment = value;
					OnPropertyChanged("PAYMENT");
				}
			}
		}
		/// <summary>
		/// 对应项目预收金额、实际放款金额、放款中抵扣手续费、放款中抵扣费用、收款金额、实收本金、实收利息、实收管理费、实收逾期利息、实收违约金
		/// </summary>
		[DataMember]
		public string FEEOBJ
		{
			get{return _feeobj;}
			set{
				if ( _feeobj!= value)
				{
					 _feeobj = value;
					OnPropertyChanged("FEEOBJ");
				}
			}
		}
		/// <summary>
		/// 对应科目
		/// </summary>
		[DataMember]
		public string SUBCODE
		{
			get{return _subcode;}
			set{
				if ( _subcode!= value)
				{
					 _subcode = value;
					OnPropertyChanged("SUBCODE");
				}
			}
		}
		/// <summary>
		/// 科目名称
		/// </summary>
		[DataMember]
		public string SUBNAME
		{
			get{return _subname;}
			set{
				if ( _subname!= value)
				{
					 _subname = value;
					OnPropertyChanged("SUBNAME");
				}
			}
		}
		/// <summary>
		/// 核算客户
		/// </summary>
		[DataMember]
		public string CUSTNAME
		{
			get{return _custname;}
			set{
				if ( _custname!= value)
				{
					 _custname = value;
					OnPropertyChanged("CUSTNAME");
				}
			}
		}
		/// <summary>
		/// 核算客户记录ID
		/// </summary>
		[DataMember]
		public long CUSTID
		{
			get{return _custid;}
			set{
				if ( _custid!= value)
				{
					 _custid = value;
					OnPropertyChanged("CUSTID");
				}
			}
		}
		/// <summary>
		/// 核算员工
		/// </summary>
		[DataMember]
		public string EMPNAME
		{
			get{return _empname;}
			set{
				if ( _empname!= value)
				{
					 _empname = value;
					OnPropertyChanged("EMPNAME");
				}
			}
		}
		/// <summary>
		/// 核算员工记录ID
		/// </summary>
		[DataMember]
		public long EMPID
		{
			get{return _empid;}
			set{
				if ( _empid!= value)
				{
					 _empid = value;
					OnPropertyChanged("EMPID");
				}
			}
		}
		/// <summary>
		/// 借/贷1借，-1贷
		/// </summary>
		[DataMember]
		public int DIRECT
		{
			get{return _direct;}
			set{
				if ( _direct!= value)
				{
					 _direct = value;
					OnPropertyChanged("DIRECT");
				}
			}
		}
		/// <summary>
		/// 设置人
		/// </summary>
		[DataMember]
		public string CREATEBY
		{
			get{return _createby;}
			set{
				if ( _createby!= value)
				{
					 _createby = value;
					OnPropertyChanged("CREATEBY");
				}
			}
		}
		/// <summary>
		/// 设置时间
		/// </summary>
		[DataMember]
		public Nullable<DateTime> CREATEDATE
		{
			get{return _createdate;}
			set{
				if ( _createdate!= value)
				{
					 _createdate = value;
					OnPropertyChanged("CREATEDATE");
				}
			}
		}
		#endregion Model

	#region ChangeTracking
	   
	protected virtual void OnPropertyChanged(String propertyName)
	{
	    if (ChangeTracker.State != ObjectState.Added && ChangeTracker.State != ObjectState.Deleted)
	    {
	        ChangeTracker.State = ObjectState.Modified;
	    }
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	protected virtual void OnNavigationPropertyChanged(String propertyName)
	{
	    if (_propertyChanged != null)
	    {
	        _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
	    }
	}
	   
	event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged{ add { _propertyChanged += value; } remove { _propertyChanged -= value; } }
	private event PropertyChangedEventHandler _propertyChanged;
	private ObjectChangeTracker _changeTracker;
	   
	[DataMember]
	public ObjectChangeTracker ChangeTracker
	{
	    get
	    {
	        if (_changeTracker == null)
	        {
	            _changeTracker = new ObjectChangeTracker();
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	        return _changeTracker;
	    }
	    set
	    {
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging -= HandleObjectStateChanging;
	        }
	        _changeTracker = value;
	        if(_changeTracker != null)
	        {
	            _changeTracker.ObjectStateChanging += HandleObjectStateChanging;
	        }
	    }
	}
	   
	private void HandleObjectStateChanging(object sender, ObjectStateChangingEventArgs e)
	{
	    if (e.NewState == ObjectState.Deleted)
	    {
	        ClearNavigationProperties();
	    }
	}
	   
	protected bool IsDeserializing { get; private set; }
	   
	[OnDeserializing]
	public void OnDeserializingMethod(StreamingContext context)
	{
	    IsDeserializing = true;
	}
	   
	[OnDeserialized]
	public void OnDeserializedMethod(StreamingContext context)
	{
	    IsDeserializing = false;
	    ChangeTracker.ChangeTrackingEnabled = true;
	}
	   
	protected virtual void ClearNavigationProperties()
	{
	}
	
	#endregion

	}
}

